﻿using System;
using System.Collections.Generic;
using RevClinic.Core.Resources;
namespace RevClinic.Core.Domain
{
    public class User : Entity<long>
    {
        public virtual UserInfo Info { get; protected set; }
        public virtual UserGroup Group { get; protected set; }
        public virtual bool IsActive { get; protected set; }

        public User()
        {
        }

        public User(UserInfo info, UserGroup group)
        {
            Check.Argument.IsNotNull(info, "info");
            Info = info;
            Group = group;
        }

        public virtual void ChangePassword(string password)
        {
            Check.Argument.IsNotNullOrWhiteSpace(password, "password");
            ChangeInfo(new UserInfo(
                Info.Login,
                password,
                Info.FirstName,
                Info.Surname,
                Info.Type));
        }

        public virtual void ChangeInfo(UserInfo userInfo)
        {
            Check.Argument.IsNotNull(userInfo, "userInfo");
            Info = userInfo;
        }
    }
}
